package org.ascollada.core.log
{
	import org.ascollada.core.log.events.DaeLogEvent;
	import org.ascollada.core.log.vo.DaeLogVO;
	
	public class DaeAbstractLogger implements IDaeLogger
	{
		public function DaeAbstractLogger()
		{
		}

		public function register( daeLogger:DaeLogger ) : void
		{
			daeLogger.addEventListener( DaeLogEvent.DAE_LOG_EVENT, this.onLogEvent );
		}
		
		public function log(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		public function info(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		public function debug(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		public function warning(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		public function error(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		public function fatal(msg:String, object:Object = null, arg:Array = null):void
		{
			
		}
		
		protected function onLogEvent( event:DaeLogEvent ) : void
		{
			var vo :DaeLogVO = event.daeLogVO;
			
			switch( vo.level )
			{
				case DaeLogLevel.LOG:
					log( vo.msg, vo.object, vo.arg );
					break;
				case DaeLogLevel.INFO:
					info( vo.msg, vo.object, vo.arg );
					break;
				case DaeLogLevel.DEBUG:
					debug( vo.msg, vo.object, vo.arg );
					break;
				case DaeLogLevel.WARNING:
					warning( vo.msg, vo.object, vo.arg );
					break;
				case DaeLogLevel.ERROR:
					error( vo.msg, vo.object, vo.arg );
					break;
				case DaeLogLevel.FATAL:
					fatal( vo.msg, vo.object, vo.arg );
					break;
			}
		}
	}
}